package com.chao.yyks.modular.paragraph.controller;

import com.alibaba.fastjson.JSONObject;
import com.chao.common.util.log.Inter;
import com.chao.common.util.reaction.PageList;
import com.chao.yyks.modular.paragraph.bean.EnParagraph;
import com.chao.yyks.modular.paragraph.service.EnParagraphService;
import com.chao.yyks.modular.score.bean.EnAnswer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;
import java.util.List;


/**
 * 阅读文章Controller
 * chao
 * 2024-09-12
 */
@RestController
@RequestMapping("/enParagraph")
public class EnParagraphController {

	/**
	 * 阅读文章Service
	 */
	@Autowired
	private EnParagraphService enParagraphService;

	/**
	 * 新增阅读文章
	 */
	@Inter("EPH_ADD_01")
	@RequestMapping(method = RequestMethod.POST, value = "insertEnParagraph")
	public void insertEnParagraph(@RequestBody EnParagraph enParagraph){
		enParagraphService.insertEnParagraph(enParagraph);
	}

	/**
	 * 修改阅读文章
	 */
	@Inter("EPH_EDT_01")
	@RequestMapping(method = RequestMethod.POST, value = "updateEnParagraph")
	public void updateEnParagraph(@RequestBody EnParagraph enParagraph){
		enParagraphService.updateEnParagraph(enParagraph);
	}

	/**
	 * 物理删除阅读文章
	 */
	@Inter("EPH_DEL_02")
	@RequestMapping(method = RequestMethod.POST, value = "deleteDataEnParagraph")
	public void deleteDataEnParagraph(@RequestBody EnParagraph enParagraph){
		enParagraphService.deleteDataEnParagraph(enParagraph.getParagraphId());
	}

	/**
	 * 查询阅读文章详情
	 */
	@Inter("EPH_SEL_01")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnParagraphByParagraphId")
	public EnParagraph selectEnParagraphByParagraphId(String paragraphId){
		return enParagraphService.selectEnParagraphByParagraphId(paragraphId);
	}

	/**
	 * 查询阅读文章列表
	 */
	@Inter("EPH_SEL_02")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnParagraphByList")
	public PageList<EnParagraph> selectEnParagraphByList(@RequestParam Map<String,Object> map){
		return enParagraphService.selectEnParagraphByList(new JSONObject(map));
	}

	/**
	 * 分页查询阅读文章列表
	 */
	@Inter("EPH_SEL_03")
	@RequestMapping(method = RequestMethod.GET, value = "selectEnParagraphByPage")
	public PageList<EnParagraph> selectEnParagraphByPage(@RequestParam Map<String,Object> map){
		return enParagraphService.selectEnParagraphByPage(new JSONObject(map));
	}

	/**
	 * 阅读题试卷
	 */
	@Inter("EPH_SEL_04")
	@RequestMapping(method = RequestMethod.POST, value = "selectEnParagraph")
	public List<EnParagraph> selectEnParagraph(@RequestBody JSONObject json){
		return enParagraphService.selectEnParagraph(json);
	}

	/**
	 * 翻译题试卷
	 */
	@Inter("EPH_SEL_05")
	@RequestMapping(method = RequestMethod.POST, value = "selectEnParagraphFY")
	public List<EnParagraph> selectEnParagraphFY(@RequestBody JSONObject json){
		json.put("problemUpType","5");
		return enParagraphService.selectEnParagraph56(json);
	}

	/**
	 * 写作题试卷
	 */
	@Inter("EPH_SEL_06")
	@RequestMapping(method = RequestMethod.POST, value = "selectEnParagraphXZ")
	public List<EnParagraph> selectEnParagraphXZ(@RequestBody JSONObject json){
		json.put("problemUpType","6");
		return enParagraphService.selectEnParagraph56(json);
	}

//	/**
//	 * 词汇题试卷
//	 */
//	@Inter("EPH_SEL_07")
//	@RequestMapping(method = RequestMethod.POST, value = "selectEnParagraphCH")
//	public List<EnAnswer> selectEnParagraphCH(@RequestBody JSONObject json){
//		return enParagraphService.selectEnParagraphCH(json);
//	}

}